<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue的全局组件案例1</title>
    <script src="js/vue.js"></script>
    <style>
        .tempateStyle{
            border: 1px dashed #000;
            border-radius: 15px;
            padding: 10px;
            width: 200px;
            height: 160px;
            text-align: center;
            float: left;
            margin-right: 50px;
            margin-bottom: 50px;
            box-shadow:10px 10px 5px #888888;
            background-image: linear-gradient(to bottom right, red, yellow);
        }
    </style>
</head>

<body>
    <template id="t1">
        <div class="tempateStyle">
            <h3>润物无声</h3>
            <h4>只做增强不做改变，引入它不会对现有工程产生影响，如丝般顺滑</h4>
        </div>
    </template>
    <div id="app" style="width: 1100px;margin: 50px auto;">
        <helloworld></helloworld>
        <helloworld></helloworld>
        <helloworld></helloworld>
        <helloworld></helloworld>
        <helloworld></helloworld>
        <helloworld></helloworld>
        <helloworld></helloworld>
        <helloworld></helloworld>
    </div>
   
</body>

</html>
<script>
    //定义全局组件
    Vue.component('helloworld', {
        //template中必须只有一个根节点
        template: '#t1'
    });
    var vm = new Vue({
        el: '#app'
    });
    var vm2 = new Vue({
        el: '#app2'
    });
</script>